#import keras
import pandas as pd
from tensorflow import keras


def download() -> pd.DataFrame:
  csv_path = keras.utils.get_file(
    'BBBP.csv', "https://deepchemdata.s3-us-west-1.amazonaws.com/datasets/BBBP.csv"
  )
  df = pd.read_csv(csv_path, usecols=[1, 2, 3])
  # columns = ['name', 'p_np', 'smiles']
  # 药物名称，1过血脑屏障 0不过, SMILES分子结构
  # rows = 2050
  return df


def read_from(f) -> pd.DataFrame:
  if f.endswith('.feather'):
    return pd.read_feather(f)
  elif f.endswith('.csv'):
    return pd.read_csv(f)
  else:
    raise NotImplementedError('# [ERROR] unsupported file format')


def inspect(f):
  df = read_from(f)
  print(df.iloc[96:104])